
<!-- Content Header (Page header) -->
<section class="content-header">
	<h1>菜单/监控机组管理</h1>
	<ol class="breadcrumb">
		<li><a href="javascript:void(0);"><i class="fa fa-dashboard"></i>
				首页</a></li>
		<li><a href="#">设备管理</a></li>
		<li class="active">菜单/监控机组管理</li>
	</ol>
</section>

<!-- Main content -->
<section class="content">
	<div class="row">
		<div class="col-xs-12">
			<div class="box box-primary">
				<div class="box-body">
					<div class="row">
						<div class="col-sm-2">
							<div class="dataTables_length">
								<label>
									<select class="form-control input-sm pageSize" style="width:auto;">
										<option>10</option>
										<option>20</option>
										<option>30</option>
										<option>30</option>
										<option>40</option>
									</select>
									记录/页
								</label>
							</div>
						</div>
						<div class="col-sm-10">
							<div class="dataTables_filter" id="searchDiv">
								<input type="search" placeholder="请输入探头名称" title="探头名称" name="probeName"
									   class="form-control">
								<input type="search" placeholder="请输入序列号" title="序列号" name="monitorSn"
									   class="form-control">
								<select  type="search"  title="监控类型" name="monitorType" class="form-control monitorType"></select>
								<select  type="search"  title="负责人" name="createUserId" class="form-control select2" hide></select>
								<select  type="search"  title="基地名称" name="hostId" class="form-control select2"></select>

								<input  type="text" placeholder="起始时间" name="startTime" readonly title="起始时间"
										class='form-control date' value=''>
								<input  type="text" placeholder="结束时间" name="endTime" readonly title="结束时间"
										class='form-control date' value=''>

								<div class="btn-group">
									<button type="button" class="btn btn-primary" data-btn-type="search">查询</button>
								</div>
								<div class="btn-group">
									<button type="button" class="btn btn-default" data-btn-type="add">新增</button>
								</div>
							</div>
						</div>
					</div>


					<table id="check_table" class="table table-bordered table-striped table-hover" style="margin-bottom:20px;">
						<thead>
						<tr>
							<th name="id" style="display:none;">id</th>
							<th name="probeName">探头名称</th>
							<th name="probeIndex">探头编号</th>
							<th name="monitorSn">序列号</th>
							<th name="code">验证码</th>
							<th name="monitorTypeName">监控类型</th>
							<th name="createUsername">负责人</th>
							<th name="hostName">基地名称</th>
							<th name="updateDateTime">更新时间</th>
							<th name="">功能选项</th>
						</tr>
						</thead>
						<tbody></tbody>
					</table>
					<div class="paging"></div>
				</div>
			</div>
		</div>
	</div>
	</div>
</section>

<script>
	$(function() {
        new Date().datepicker();
        AsyncGet("${basePath}/manager/user/getUserRole",null,function (value) {
            if(value.data.role!="超级管理员"){
                $("#searchDiv [hide]").next().hide();
            }
        })
        loadSelectByClassSync("${basePath}/manager/monitor/getMonitorTypeList",null,"monitorType","--请选择监控类型--","monitorType","typeName");
        $(".dataTables_filter [name='createUserId']").loadSelect2(
            "${basePath}/root/function/getBackgroundManagerList",
            "请输入姓名查询",2,"username","username");
        $(".dataTables_filter [name='hostId']").loadSelect2(
            "${basePath}/manager/host/getHostListByName",
            "请输入名称查询",2,"hostName","hostName");
        var table=initTable("${basePath}/manager/monitor/getMonitorList",
            $(".content #searchDiv"),
            $(".content table"),
            $(".content .pageSize"),
            $(".content .paging"));
        var param={
            htmlUrl:"${basePath}/function/manager/monitor/monitorForm",
            getEntityUrl:"${basePath}/manager/monitor/getMonitorInfo",
            updateEntityUrl:"${basePath}/manager/monitor/editMonitor",
            deleteEntityUrl:" ${basePath}/manager/monitor/deleteMonitor",
            editTitle:"编辑监控信息",
            addTitle:"添加监控",
            addButton:$("[data-btn-type='add']"),
            table:$(".content table"),
            getEntityBefore:function (value) {
                if(value.createUserId!=null){
                    var option=$("<option></option>");
                    option.attr("value",value.createUserId);
                    option.text(value.createUsername);
                    $("#monitorForm [name='createUserId']").empty().append(option);
				}

            },
            getEntityCallback:function (value) {
                if(value.leftValue==null){
                    $("#monitorForm .iconfont").css({left:"50%",top:"50%"});
				}else{
                    var left=value.leftValue+"%";
                    var top=value.topValue+"%";
                    $("#monitorForm .iconfont").css({left:left,top:top});
				}

            },
            addCallback:function () {
                $("#monitorForm .iconfont").css({left:"50%",top:"50%"});
            }
		};
        EditEntity(param,table.search);

    });
</script>
